package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	UserName    string `gorm:"type:varchar(30)"`
	UserAccount string `gorm:"type:varchar(30)"`
	UserPass    string `gorm:"type:varchar(30)"`
}

func (u *User) GetUserByUserAccount() error {
	return DB.Where("user_account = ?", u.UserAccount).Limit(1).Find(&u).Error
}
func (u *User) CreateUser() error {
	u.UserName = "未命名"
	return DB.Create(&u).Error
}
